package school;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        Map map=new HashMap();
        map.put("东邪","JAVA");
        map.put("西毒","C 语言");
        map.put("南帝","JSP");
        map.put("北丐","JSP");
        map.put("老顽童","Linux");
        map.put("郭靖","Spring boot");
        map.put("黄蓉","软件工程");
        //增加了一位新老师Mary，教JDBC
        map.put("Mary","JDBC");
        //郭靖改为教 java
        map.put("郭靖","JAVA");
        //遍历Map
        System.out.println("name   lecture");
        Iterator it=map.entrySet().iterator();
        System.out.println("输出所有老师及老师教授的课程");
        while(it.hasNext()){
            Map.Entry en=(Map.Entry)it.next();
            System.out.println(en.getKey()+"\t"+en.getValue());
            if("JSP".equals(en.getValue())){
                System.out.println("输出所有教JSP的老师"+"JSP"+en.getKey());
            }
        }
    }
}
